<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  <style>

  </style>
</head>

<body>
  <h1>Upload</h1>
  <form action="/upload" method="post" enctype="multipart/form-data" id="form1">
    <p>请选择文件: <input type="file" name="file" id="uploadFile"></p>
    <p>
      请选择分类：
      <select name="kind" id="select">
        <option value="poem">唐诗</option>
        <option value="poetry">宋词</option>
        <option value="img">图片</option>
      </select>
    </p>
    <p>输入标题： <input type="text" name="title"></p>
    <p><input type="button" value="提交" onclick="submitForm()"/></p>
  </form>
  <script>
    function submitForm() {
      var uploadFile = document.getElementById('uploadFile')
      var file = uploadFile.files[0]
      var type = file.type
      var fileSize = file.size
      // 100k
      if (fileSize > 1024 * 100) {
        alert('file type/size error, please check')
        return
      }
      $("#form1").submit()
    }
  </script>
</body>

</html>